<?php

namespace api\wechat;

class richtext
{
    //获取全部的自定义按钮
    public function getAll($data){
        $con=con();
        $data=mysqli_query($con,"select id,name,icon,url,status,is_delete,create_time,update_time,remark from richtext where status=1 and is_delete=1 order by `id` asc ");
        $data=mysqli_fetch_all($data,true);
        mysqli_close($con);
        return out_right($data);
    }

    //根据id查询详情
    public function getRichtextInfoById($data){
        $id=(int)$data['id'];
        $con=con();
        $info=mysqli_query($con,"select * from richtext where id=$id and status=1 and is_delete=1  ");
        $info=mysqli_fetch_all($info,true);
        mysqli_close($con);
        if(empty($info)){
            return out_error('查无数据');
        }else{
            return out_right($info[0]);
        }
    }

}